//
// Created by sukai on 22-9-19.
//

#include <iostream>
#include <ros/ros.h>
#include <signal.h>
#include "contnav_msgs/Dictionaries.h"
#include "contnav_msgs/DictionariesVector.h"
#include "contnav_srvs/TABLE_CONTORLLER.h"
#include "common.h"
#include <queue>
using namespace std;
/**
 *
 * @param argc
 * @param argv
 * @return
 * 测试节点
 * 2022-09-19
 * sukai
 * rosrun contnav test_node
 */



map<string, string> dictionariesMap_;


struct node1{
    int data;
}a[10];

//ctrl + c
void mySigintHandler(int sig)
{
    std::cout << "ctrl c  sig: "<<sig<<std::endl;

    ros::shutdown();
    if (ros::isShuttingDown()){
        cout<<"close ros  test.cpp"<<endl;
    }
}


// rosrun contnav test_node
int main(int argc,char *argv[]){
    //节点名
    string nodeName = "test_contnav_contnav_global_planner_node";
    //初始化节点
    ros::init(argc,argv,nodeName);
    //创建节点
    ros::NodeHandle node;
    //监控 ctrl c
    signal(SIGINT, mySigintHandler);


    queue<node1> q;
    for(int i = 1;i <= 3;i++){
        a[i].data = i;
        q.push(a[i]);
    }
    //尝试直接把队首元素的数据域改为100
    q.front().data = 100;
    //事实上对队列元素的修改无法改变原元素
   // printf("%d %d %d\n",a[1].data,a[2].data,a[3].data);
    //直接修改a[1]的数据域
   // a[1].data = 200;
    //事实上对原元素的修改也无法改变队列中的元素
    printf("%d\n",q.front().data);//可以改变值 2023-1-10



    //事件轮询
    ros::spin();
    return 0;
}


